package com.victor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.victor.dao.PoiSubmitDao;
import com.victor.entity.poi.PoiPhoto;
import com.victor.entity.poi.PoiSubmit;
import com.victor.service.PoisubmitService;
@Service
public class PoisubmitServiceImpl implements PoisubmitService{
	@Autowired
	private PoiSubmitDao poiDao;

	@Override
	public boolean addPoi(PoiSubmit poiSubmit) {
		return poiDao.insertSelective(poiSubmit);
	}

	@Override
	public boolean insertPoiPhoto(PoiPhoto poiPhoto) {
		return poiDao.insertPhoto(poiPhoto);
	}


	@Override
	public PoiSubmit selById(Integer id) {
		return poiDao.selectByPrimaryKey(id);
	}

	@Override
	public boolean update(PoiSubmit poiSubmit) {
		return poiDao.updateByPrimaryKeySelective(poiSubmit);
	}

	@Override
	public PageInfo<PoiSubmit> selAllOrSearchOrFlag(int row, int page, String search, String flag) {
		PageHelper.startPage(page, row);
		List<PoiSubmit> list = poiDao.selAllOrSearchOrFlag(search,flag);
		return new PageInfo<>(list, 5);
	}

	@Override
	public List<PoiSubmit> selAll() {
		return poiDao.selAll();
	}

}
